<?php
/**
 * Created by PhpStorm.
 * User: 技术员专用
 * Date: 2019/3/25
 * Time: 10:17
 */

namespace app\index\controller;


use app\common\lib\Util;

class Chart
{
    public function index(){
        if (empty(request()->param('game_id'))){
            Util::show(0,'error');
        }
        if (empty(request()->param('content'))){
            Util::show(0,'error');
        }
        $data=[
            'user'=>'用户'.rand(0,3200),
            'content'=>request()->param('content'),
        ];
        foreach ($_SERVER['http_server']->ports[1]->connections as $fd){
            $_SERVER['http_server']->push($fd,json_encode($data));
        }
    }
}